<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>局域网视频学习系统</title>
    <link rel="stylesheet" href="css/common.css">
    <style>
        body {
            background: linear-gradient(135deg, #2E86AB 0%, #1A535C 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        .welcome-container {
            background: white;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
            padding: 40px;
            width: 100%;
            max-width: 600px;
            margin: 20px;
            text-align: center;
        }

        .welcome-logo {
            width: 120px;
            height: 120px;
            background: var(--primary-color);
            border-radius: 50%;
            margin: 0 auto 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 48px;
            font-weight: bold;
        }

        .welcome-title {
            font-size: 32px;
            font-weight: bold;
            color: var(--neutral-dark);
            margin-bottom: 16px;
        }

        .welcome-subtitle {
            color: #666;
            font-size: 16px;
            margin-bottom: 40px;
            line-height: 1.6;
        }

        .login-buttons {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .login-btn {
            display: block;
            padding: 16px 24px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            text-decoration: none;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .btn-primary {
            background: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            background: #1e5f7a;
        }

        .btn-secondary {
            background: #f8f9fa;
            color: var(--neutral-dark);
            border: 2px solid var(--border-color);
        }

        .btn-secondary:hover {
            background: #e9ecef;
            border-color: var(--primary-color);
        }

        .features {
            margin-top: 40px;
            padding-top: 30px;
            border-top: 1px solid var(--border-color);
        }

        .features-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--neutral-dark);
            margin-bottom: 20px;
        }

        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 20px;
        }

        .feature-item {
            text-align: center;
        }

        .feature-icon {
            font-size: 32px;
            margin-bottom: 8px;
        }

        .feature-name {
            font-size: 14px;
            color: #666;
        }

        @media (max-width: 480px) {
            .welcome-container {
                margin: 10px;
                padding: 30px 20px;
            }
            
            .welcome-title {
                font-size: 24px;
            }
            
            .features-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }
    </style>
</head>
<body>
    <div class="welcome-container">
        <div class="welcome-logo">📚</div>
        <h1 class="welcome-title">局域网视频学习系统</h1>
        <p class="welcome-subtitle">
            专为局域网环境设计的在线学习平台<br>
            支持视频教学、在线考试、学习管理等功能
        </p>

        <div class="login-buttons">
            <a href="login.html" class="login-btn btn-primary">
                🔐 登录系统
            </a>
            <a href="register.html" class="login-btn btn-secondary">
                📝 注册账户
            </a>
        </div>

        <div class="features">
            <h3 class="features-title">系统特色</h3>
            <div class="features-grid">
                <div class="feature-item">
                    <div class="feature-icon">🎥</div>
                    <div class="feature-name">视频教学</div>
                </div>
                <div class="feature-item">
                    <div class="feature-icon">📝</div>
                    <div class="feature-name">在线考试</div>
                </div>
                <div class="feature-item">
                    <div class="feature-icon">👥</div>
                    <div class="feature-name">用户管理</div>
                </div>
                <div class="feature-item">
                    <div class="feature-icon">📊</div>
                    <div class="feature-name">学习统计</div>
                </div>
            </div>
        </div>
    </div>

    <script src="js/common.js"></script>
    <script>
        // 检查是否已登录
        document.addEventListener('DOMContentLoaded', async function() {
            await UserManager.init();
            if (UserManager.isLoggedIn()) {
                const user = UserManager.getCurrentUser();
                switch (user.role) {
                    case 0:
                        window.location.href = 'admin/dashboard.html';
                        break;
                    case 1:
                        window.location.href = 'teacher/dashboard.html';
                        break;
                    case 2:
                        window.location.href = 'student/index.html';
                        break;
                }
            }
        });
    </script>
</body>
</html>
